﻿using System;
using System.IO;
using Manager;
using UnityEngine;

// Token: 0x020002D2 RID: 722
[Serializable]
public abstract class CharFileInfoCustom : global::BlockControlBase
{
	// Token: 0x06001176 RID: 4470 RVA: 0x0008E1CC File Offset: 0x0008C3CC
	public CharFileInfoCustom(int hknum) : base("カスタム情報", 4)
	{
		this.hairKindNum = hknum;
	}

	// Token: 0x06001177 RID: 4471 RVA: 0x0008E250 File Offset: 0x0008C450
	public void MemberInitialize()
	{
		if (this.shapeValueFace != null)
		{
			for (int i = 0; i < this.shapeValueFace.Length; i++)
			{
				this.shapeValueFace[i] = 0.5f;
			}
		}
		if (this.shapeValueBody != null)
		{
			for (int j = 0; j < this.shapeValueBody.Length; j++)
			{
				this.shapeValueBody[j] = 0.5f;
			}
		}
		this.headId = 0;
		this.skinColor.SetDiffuseRGB(Color.white);
		this.skinColor.SetSpecularRGB(Color.white);
		this.texFaceId = 0;
		this.texTattoo_fId = 0;
		this.tattoo_fColor.SetDiffuseRGBA(Color.white);
		this.matEyebrowId = 0;
		this.eyebrowColor.SetDiffuseRGBA(Color.white);
		this.eyebrowColor.hsvDiffuse.S = 1f;
		this.matEyeLId = 0;
		this.eyeLColor.SetDiffuseRGBA(Color.white);
		this.eyeLColor.hsvDiffuse.S = 1f;
		this.matEyeRId = 0;
		this.eyeRColor.SetDiffuseRGBA(Color.white);
		this.eyeRColor.hsvDiffuse.S = 1f;
		this.eyeWColor.SetDiffuseRGB(Color.white);
		this.texFaceDetailId = 0;
		this.faceDetailWeight = 0.5f;
		this.texBodyId = 0;
		this.texTattoo_bId = 0;
		this.tattoo_bColor.SetDiffuseRGBA(Color.white);
		this.texBodyDetailId = 0;
		this.bodyDetailWeight = 0f;
		this.voicePitch = 1f;
		this.isConcierge = false;
	}

	// Token: 0x06001178 RID: 4472 RVA: 0x0008E3EC File Offset: 0x0008C5EC
	public override byte[] SaveBytes()
	{
		byte[] result;
		using (MemoryStream memoryStream = new MemoryStream())
		{
			using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
			{
				binaryWriter.Write(1);
				binaryWriter.Write(this.shapeValueFace.Length);
				for (int i = 0; i < this.shapeValueFace.Length; i++)
				{
					binaryWriter.Write(this.shapeValueFace[i]);
				}
				binaryWriter.Write(this.shapeValueBody.Length);
				for (int j = 0; j < this.shapeValueBody.Length; j++)
				{
					binaryWriter.Write(this.shapeValueBody[j]);
				}
				binaryWriter.Write(this.hairKindNum);
				for (int k = 0; k < this.hairKindNum; k++)
				{
					binaryWriter.Write(this.hairId[k]);
					this.hairColor[k].Save(binaryWriter);
					this.hairAcsColor[k].Save(binaryWriter);
				}
				binaryWriter.Write(this.hairType);
				binaryWriter.Write(this.headId);
				this.skinColor.Save(binaryWriter);
				binaryWriter.Write(this.texFaceId);
				binaryWriter.Write(this.texTattoo_fId);
				this.tattoo_fColor.Save(binaryWriter);
				binaryWriter.Write(this.matEyebrowId);
				this.eyebrowColor.Save(binaryWriter);
				binaryWriter.Write(this.matEyeLId);
				this.eyeLColor.Save(binaryWriter);
				binaryWriter.Write(this.matEyeRId);
				this.eyeRColor.Save(binaryWriter);
				this.eyeWColor.Save(binaryWriter);
				binaryWriter.Write(this.texFaceDetailId);
				binaryWriter.Write(this.faceDetailWeight);
				binaryWriter.Write(this.texBodyId);
				binaryWriter.Write(this.texTattoo_bId);
				this.tattoo_bColor.Save(binaryWriter);
				binaryWriter.Write(this.texBodyDetailId);
				binaryWriter.Write(this.bodyDetailWeight);
				binaryWriter.Write(this.name);
				binaryWriter.Write(this.personality);
				binaryWriter.Write(this.voicePitch);
				binaryWriter.Write(this.isConcierge);
				this.SaveSub(binaryWriter);
				result = memoryStream.ToArray();
			}
		}
		return result;
	}

	// Token: 0x06001179 RID: 4473 RVA: 0x0008E65C File Offset: 0x0008C85C
	public override bool LoadBytes(byte[] data, int customVer)
	{
		bool result;
		using (MemoryStream memoryStream = new MemoryStream(data))
		{
			using (BinaryReader binaryReader = new BinaryReader(memoryStream))
			{
				int num = binaryReader.ReadInt32();
				int num2 = binaryReader.ReadInt32();
				for (int i = 0; i < num2; i++)
				{
					this.shapeValueFace[i] = global::CharFile.ClampEx(binaryReader.ReadSingle(), 0f, 1f);
				}
				num2 = binaryReader.ReadInt32();
				for (int j = 0; j < num2; j++)
				{
					this.shapeValueBody[j] = global::CharFile.ClampEx(binaryReader.ReadSingle(), 0f, 1f);
				}
				num2 = binaryReader.ReadInt32();
				for (int k = 0; k < num2; k++)
				{
					this.hairId[k] = binaryReader.ReadInt32();
					this.hairColor[k].Load(binaryReader, num);
					this.hairAcsColor[k].Load(binaryReader, num);
				}
				if (2 <= customVer)
				{
					this.hairType = binaryReader.ReadInt32();
				}
				this.headId = binaryReader.ReadInt32();
				this.skinColor.Load(binaryReader, num);
				this.texFaceId = binaryReader.ReadInt32();
				this.texTattoo_fId = binaryReader.ReadInt32();
				this.tattoo_fColor.Load(binaryReader, num);
				this.matEyebrowId = binaryReader.ReadInt32();
				this.eyebrowColor.Load(binaryReader, num);
				this.matEyeLId = binaryReader.ReadInt32();
				this.eyeLColor.Load(binaryReader, num);
				this.matEyeRId = binaryReader.ReadInt32();
				this.eyeRColor.Load(binaryReader, num);
				this.eyeWColor.Load(binaryReader, num);
				this.texFaceDetailId = binaryReader.ReadInt32();
				this.faceDetailWeight = binaryReader.ReadSingle();
				this.texBodyId = binaryReader.ReadInt32();
				this.texTattoo_bId = binaryReader.ReadInt32();
				this.tattoo_bColor.Load(binaryReader, num);
				this.texBodyDetailId = binaryReader.ReadInt32();
				this.bodyDetailWeight = binaryReader.ReadSingle();
				this.name = binaryReader.ReadString();
				this.personality = binaryReader.ReadInt32();
				if (global::Singleton<Manager.Character>.IsInstance() && !global::Singleton<Manager.Character>.Instance.charaListInfo.IsPersonality(this.personality))
				{
					this.personality = 0;
				}
				if (3 <= customVer)
				{
					this.voicePitch = binaryReader.ReadSingle();
				}
				if (4 <= customVer)
				{
					this.isConcierge = binaryReader.ReadBoolean();
				}
				result = this.LoadSub(binaryReader, customVer, num);
			}
		}
		return result;
	}

	// Token: 0x0600117A RID: 4474
	public abstract bool SaveSub(BinaryWriter bw);

	// Token: 0x0600117B RID: 4475
	public abstract bool LoadSub(BinaryReader br, int customVer, int colorVer);

	// Token: 0x0600117C RID: 4476 RVA: 0x0008E914 File Offset: 0x0008CB14
	public bool ModCheck()
	{
		for (int i = 0; i < this.shapeValueFace.Length; i++)
		{
			if (!global::MathfEx.RangeEqualOn(0f, this.shapeValueFace[i], 1f))
			{
				return true;
			}
		}
		for (int j = 0; j < this.shapeValueBody.Length; j++)
		{
			if (!global::MathfEx.RangeEqualOn(0f, this.shapeValueBody[j], 1f))
			{
				return true;
			}
		}
		return this.ModCheckSub();
	}

	// Token: 0x0600117D RID: 4477
	public abstract bool ModCheckSub();

	// Token: 0x04001784 RID: 6020
	public byte sex;

	// Token: 0x04001785 RID: 6021
	public int customLoadVersion;

	// Token: 0x04001786 RID: 6022
	public readonly int hairKindNum;

	// Token: 0x04001787 RID: 6023
	public float[] shapeValueFace;

	// Token: 0x04001788 RID: 6024
	public float[] shapeValueBody;

	// Token: 0x04001789 RID: 6025
	public int[] hairId;

	// Token: 0x0400178A RID: 6026
	public int hairType;

	// Token: 0x0400178B RID: 6027
	public global::HSColorSet[] hairColor;

	// Token: 0x0400178C RID: 6028
	public global::HSColorSet[] hairAcsColor;

	// Token: 0x0400178D RID: 6029
	public int headId;

	// Token: 0x0400178E RID: 6030
	public global::HSColorSet skinColor = new global::HSColorSet();

	// Token: 0x0400178F RID: 6031
	public int texFaceId;

	// Token: 0x04001790 RID: 6032
	public int texTattoo_fId;

	// Token: 0x04001791 RID: 6033
	public global::HSColorSet tattoo_fColor = new global::HSColorSet();

	// Token: 0x04001792 RID: 6034
	public int matEyebrowId;

	// Token: 0x04001793 RID: 6035
	public global::HSColorSet eyebrowColor = new global::HSColorSet();

	// Token: 0x04001794 RID: 6036
	public int matEyeLId;

	// Token: 0x04001795 RID: 6037
	public global::HSColorSet eyeLColor = new global::HSColorSet();

	// Token: 0x04001796 RID: 6038
	public int matEyeRId;

	// Token: 0x04001797 RID: 6039
	public global::HSColorSet eyeRColor = new global::HSColorSet();

	// Token: 0x04001798 RID: 6040
	public global::HSColorSet eyeWColor = new global::HSColorSet();

	// Token: 0x04001799 RID: 6041
	public int texFaceDetailId;

	// Token: 0x0400179A RID: 6042
	public float faceDetailWeight;

	// Token: 0x0400179B RID: 6043
	public int texBodyId;

	// Token: 0x0400179C RID: 6044
	public int texTattoo_bId;

	// Token: 0x0400179D RID: 6045
	public global::HSColorSet tattoo_bColor = new global::HSColorSet();

	// Token: 0x0400179E RID: 6046
	public int texBodyDetailId;

	// Token: 0x0400179F RID: 6047
	public float bodyDetailWeight;

	// Token: 0x040017A0 RID: 6048
	public string name = string.Empty;

	// Token: 0x040017A1 RID: 6049
	public int personality;

	// Token: 0x040017A2 RID: 6050
	public float voicePitch = 1f;

	// Token: 0x040017A3 RID: 6051
	public bool isConcierge;

	// Token: 0x040017A4 RID: 6052
	static int WIDESLIDER_080;
}
